package com.ldx.blog.pojo.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ldx.blog.pojo.dataobject.BlogInfo;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.time.LocalDateTime;
@Data
public class BlogInfoResponse {
    private Integer id;
    private String title;
    private String content;
    private Integer userId;
    @JsonFormat(pattern = "yy年MM月dd日hh-mm-ss")
    private LocalDateTime createTime;

    public static BlogInfoResponse trans(BlogInfo blogInfo){
        BlogInfoResponse blogInfoResponse = new BlogInfoResponse();
        BeanUtils.copyProperties(blogInfo,blogInfoResponse);
        return blogInfoResponse;
    }

}
